Carbon


ControlEditTextValidationProcPtr

Header: ControlDefinitions.h Carbon status: Supported

Ensures that the content of an editable text control is valid.

typedef void(* ControlEditTextValidationProcPtr) (
    ControlRef control
);

You would declare your function like this if you were to name it MyControlEditTextValidationCallback:

void MyControlEditTextValidationCallback (
    ControlRef control
);
control

A handle to the control containing the editable text to be validated.

DISCUSSION

Your application typically uses a MyControlEditTextValidationCallback function in conjunction with a key filter function to ensure that editable text is valid in cases such as a cut, paste, or clear, where a key filter cannot be called. Use the kControlEditTextValidationProcTag control data tag constant, described in “Mac OS 8.5 Editable Text Control Data Tag Constants”, with the functions SetControlData and GetControlData to set or retrieve a MyControlEditTextValidationCallback function.

Note that if you are using the inline input editable text control variant, the Control Manager will not call your MyControlEditTextValidationCallback function during inline input. Instead, you may install your own Text Services Manager TSMTEPostUpdateUPP callback function to validate text during inline input, or your application can validate the input itself, immediately prior to using the text.

When you implement your editable text validation function, the pointer that you pass to SetControlData must be a universal procedure pointer of the following type:

typedef ControlEditTextValidationProcPtr ControlEditTextValidationUPP;

To create a universal procedure pointer for your application-defined editable text validation function, you should use the NewControlEditTextValidationProc macro as follows:

ControlEditTextValidationUPP myControlEditTextValidationUPP;

myControlEditTextValidationUPP = NewControlEditTextValidationProc

(MyControlEditTextValidationCallback);

You can then pass myControlEditTextValidationUPP in the inData parameter of SetControlData. When you no longer need the universal procedure pointer, you should remove it using the DisposeRoutineDescriptor function.

If you need to call your application-defined function from outside your application for some reason (for example, from a plug-in), you should use the CallControlEditTextValidationProc macro to make the call, as follows:

ControlEditTextValidationUPP myControlEditTextValidationUPP;

CallControlEditTextValidationProc (myControlEditTextValidationUPP, control);

Using this macro ensures that the call is made through a universal procedure pointer.

VERSION NOTES

This function is available with Mac OS 8.5 and later.

AVAILABILITY

Supported in Carbon.


© 2000 Apple Computer, Inc. — (Last Updated 5/8/2000)